
class.gjBtn = extends(class.tgBtn) {
    reload = true,
    new = function (parent,x,y,w,h)
        local panel = class.gjBtn:builder 
        {
            parent = parent,
            x = x,
            y = y,
            w = w,
            h = h,
        }
        return panel
    end,
    set_data = function(self,skill)
        self.skill = skill
        if skill then
            if skill.level==0 then
                self.back:show()
            else
                self.back:hide()
            end
            if skill.level==50 then
                self:set_normal_image(self.icon2)
            else
                self:set_normal_image(self.icon1)
            end
            self.title:set_text(skill.name)
            self.load:set_text(('进度：%s/50'):format(skill.level))
            self:show()
        else
            self:hide()
        end
    end
}

--[面板]
class.save_ui5 = extends(class.panel) {
    reload = true,
    btn_class = class.gjBtn,
    new = function (parent,x,y,w,h)
        local panel = class.save_ui5:builder 
        {
            parent = parent,
            x = x,
            y = y,
            w = w,
            h = h,
        }
        return panel
    end,
    init = function (self)
        class.panel.init(self)
        
        self.point = self:add_text('|cffffff00捕鱼积分|r',20,20,nil,30,16,4)
        self.reload = self:add_button([[UI\存档装备\右侧-小标签暗.tga]],self.w - 250,10,150,50,1)
        self.reload:add_text('重置',0,0,150,50,12,5)
        self.reload:set_highlight([[UI\存档装备\右侧-小标签亮.tga]])
        --分割线
        self:add_panel([[ui\通关存档\分割线.tga]],0,60,self.w,2)
        
        local w,h = 250,80
        local buttons = {}
        for a=1,10 do
            local x = ((a-1)%3) * (w+5) + 20
            local y = (math.ceil(a/3) - 1) * (h + 5) + 80
            local button = self:add(self.btn_class,x,y,w,h)
            buttons[a] = button
        end
        self.buttons = buttons

        return self
    end,
        
    update = function(self)
        local player = ac.player.self
        local data = ac['捕鱼存档'] or {}
        self.point:set_text(('|cffffff00捕鱼积分：%s|r'):format(player:get_data('捕鱼积分',0) - player:get_data('捕鱼积分-使用',0)))
        for a,button in ipairs(self.buttons) do
            local skill = data[a]
            button:set_data(skill)
        end
        
    end,

    on_button_mouse_enter = function(self,button)
        local skill = button.skill
        if skill then
            button:tooltip(skill.name,format_obj(skill,skill.tip),'bottom',400)
            --button:tooltip(skill:get_title(),skill:get_tip())
        end
    end,
    on_button_clicked = function(self,button)
        local skill = button.skill
        if skill then
            ac.sync('同步-升级捕鱼存档',skill.name)
        end
        if button==self.reload then
            ac.sync('同步-重置捕鱼存档')
        end
    end,
    on_button_right_clicked = function(self,button)
        local skill = button.skill
        if skill then
            ac.sync('同步-升级捕鱼存档',skill.name,10)
        end
    end,

}

-- local w,h = 1000,600
-- local ui = class.save_ui3:builder 
-- {
--     x = (1920 - w)/2,
--     y = 150,
--     w = w,
--     h = h,
-- }